%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/polymorphic/person-app-vulns.app-order"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: 10, 11, 28, 39, 65, 12<br />2: PgSelect[9]<br />3: Connection[13]<br />4: ConnectionItems[15]"):::bucket
    Bucket1("Bucket 1 (nullableBoundary)<br />Deps: 13, 15, 12, 28, 39<br /><br />ROOT Connectionᐸ9ᐳ[13]"):::bucket
    Bucket3("Bucket 3 (listItem)<br />Deps: 12, 28, 39<br /><br />ROOT __Item{3}ᐸ15ᐳ[18]"):::bucket
    Bucket4("Bucket 4 (nullableBoundary)<br />Deps: 19, 12, 28, 39<br /><br />ROOT PgSelectSingle{3}ᐸpeopleᐳ[19]<br />1: <br />ᐳ: 20, 21<br />2: PgUnionAll[23]<br />3: Connection[27]<br />4: ConnectionItems[29]"):::bucket
    Bucket6("Bucket 6 (listItem)<br />Deps: 23, 39, 12<br /><br />ROOT __Item{6}ᐸ29ᐳ[32]"):::bucket
    Bucket7("Bucket 7 (nullableBoundary)<br />Deps: 41, 33, 12, 43, 35<br /><br />ROOT Edge{6}[33]"):::bucket
    Bucket8("Bucket 8 (polymorphic)<br />__typename: Access[42]<br />Deps: 42, 12, 43"):::bucket
    Bucket9("Bucket 9 (polymorphicPartition)<br />|AwsApplication<br />Deps: 12, 43<br />ᐳAwsApplication<br /><br />1: PgSelect[44]<br />2: PgSelectRows[49]<br />ᐳ: 48, 50, 59, 61, 63"):::bucket
    Bucket10("Bucket 10 (polymorphicPartition)<br />|GcpApplication<br />Deps: 12, 43<br />ᐳGcpApplication<br /><br />1: PgSelect[52]<br />2: PgSelectRows[57]<br />ᐳ: 56, 58, 60, 62, 64"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket3
    Bucket3 --> Bucket4
    Bucket4 --> Bucket6
    Bucket6 --> Bucket7
    Bucket7 --> Bucket8
    Bucket8 --> Bucket9 & Bucket10

    %% plan dependencies
    PgSelect9[["PgSelect[9∈0] ➊<br />ᐸpeopleᐳ<br />More deps:<br />- Object[12]<br />- Constantᐸ4ᐳ[65]"]]:::plan
    Object12{{"Object[12∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ<br />Dependents: 4"}}:::plan
    Access10{{"Access[10∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access11{{"Access[11∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access10 & Access11 --> Object12
    Connection13[["Connection[13∈0] ➊<br />ᐸ9ᐳ<br />More deps:<br />- Constantᐸ4ᐳ[65]"]]:::plan
    PgSelect9 --> Connection13
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access10
    __Value2 --> Access11
    ConnectionItems15[["ConnectionItems[15∈0] ➊"]]:::plan
    Connection13 --> ConnectionItems15
    __Item18[/"__Item[18∈3]<br />ᐸ15ᐳ"\]:::itemplan
    ConnectionItems15 ==> __Item18
    PgSelectSingle19{{"PgSelectSingle[19∈3]<br />ᐸpeopleᐳ"}}:::plan
    __Item18 --> PgSelectSingle19
    PgUnionAll23[["PgUnionAll[23∈4]<br />ᐸAwsApplication,GcpApplicationᐳ<br />More deps:<br />- Object[12]<br />- Constantᐸ[Function: applyInputConstant]ᐳ[28]"]]:::plan
    PgClassExpression20{{"PgClassExpression[20∈4]<br />ᐸ__people__.”person_id”ᐳ"}}:::plan
    PgClassExpression20 --> PgUnionAll23
    PgSelectSingle19 --> PgClassExpression20
    PgClassExpression21{{"PgClassExpression[21∈4]<br />ᐸ__people__.”username”ᐳ"}}:::plan
    PgSelectSingle19 --> PgClassExpression21
    Connection27[["Connection[27∈4]<br />ᐸ23ᐳ"]]:::plan
    PgUnionAll23 --> Connection27
    ConnectionItems29[["ConnectionItems[29∈4]"]]:::plan
    Connection27 --> ConnectionItems29
    List40{{"List[40∈6]<br />ᐸ37,38,39ᐳ<br />More deps:<br />- Constantᐸ[HIDDEN]ᐳ[39]"}}:::plan
    Access37{{"Access[37∈6]<br />ᐸ32.0ᐳ"}}:::plan
    Access38{{"Access[38∈6]<br />ᐸ32.1ᐳ"}}:::plan
    Access37 & Access38 --> List40
    Edge33{{"Edge[33∈6]"}}:::plan
    __Item32[/"__Item[32∈6]<br />ᐸ29ᐳ"\]:::itemplan
    PgCursor35{{"PgCursor[35∈6]"}}:::plan
    __Item32 & PgCursor35 --> Edge33
    Access34{{"Access[34∈6]<br />ᐸ23.cursorDetailsᐳ"}}:::plan
    __Item32 & Access34 --> PgCursor35
    ConnectionItems29 ==> __Item32
    PgUnionAll23 --> Access34
    __Item32 --> Access37
    __Item32 --> Access38
    Lambda41{{"Lambda[41∈6]<br />ᐸtoSpecifierᐳ"}}:::plan
    List40 --> Lambda41
    Access43{{"Access[43∈6]<br />ᐸ41.idᐳ"}}:::plan
    Lambda41 --> Access43
    Access42{{"Access[42∈7]<br />ᐸ41.__typenameᐳ"}}:::plan
    Lambda41 --> Access42
    PgSelect44[["PgSelect[44∈9]<br />ᐸaws_applicationsᐳ<br />ᐳAwsApplication<br />More deps:<br />- Object[12]"]]:::plan
    Access43 --> PgSelect44
    First48{{"First[48∈9]^"}}:::plan
    PgSelectRows49[["PgSelectRows[49∈9]^"]]:::plan
    PgSelectRows49 --> First48
    PgSelect44 --> PgSelectRows49
    PgSelectSingle50{{"PgSelectSingle[50∈9]^<br />ᐸaws_applicationsᐳ"}}:::plan
    First48 --> PgSelectSingle50
    PgClassExpression59{{"PgClassExpression[59∈9]^<br />ᐸ__aws_appl...ons__.”id”ᐳ"}}:::plan
    PgSelectSingle50 --> PgClassExpression59
    PgClassExpression61{{"PgClassExpression[61∈9]^<br />ᐸ__aws_appl...s__.”name”ᐳ"}}:::plan
    PgClassExpression59 o--o PgClassExpression61
    PgClassExpression63{{"PgClassExpression[63∈9]^<br />ᐸ__aws_appl..._deployed”ᐳ"}}:::plan
    PgClassExpression61 o--o PgClassExpression63
    PgSelect52[["PgSelect[52∈10]<br />ᐸgcp_applicationsᐳ<br />ᐳGcpApplication<br />More deps:<br />- Object[12]"]]:::plan
    Access43 --> PgSelect52
    First56{{"First[56∈10]^"}}:::plan
    PgSelectRows57[["PgSelectRows[57∈10]^"]]:::plan
    PgSelectRows57 --> First56
    PgSelect52 --> PgSelectRows57
    PgSelectSingle58{{"PgSelectSingle[58∈10]^<br />ᐸgcp_applicationsᐳ"}}:::plan
    First56 --> PgSelectSingle58
    PgClassExpression60{{"PgClassExpression[60∈10]^<br />ᐸ__gcp_appl...ons__.”id”ᐳ"}}:::plan
    PgSelectSingle58 --> PgClassExpression60
    PgClassExpression62{{"PgClassExpression[62∈10]^<br />ᐸ__gcp_appl...s__.”name”ᐳ"}}:::plan
    PgClassExpression60 o--o PgClassExpression62
    PgClassExpression64{{"PgClassExpression[64∈10]^<br />ᐸ__gcp_appl..._deployed”ᐳ"}}:::plan
    PgClassExpression62 o--o PgClassExpression64

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect9,Access10,Access11,Object12,Connection13,ConnectionItems15 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1 bucket1
    classDef bucket3 stroke:#ffa500
    class Bucket3,__Item18,PgSelectSingle19 bucket3
    classDef bucket4 stroke:#0000ff
    class Bucket4,PgClassExpression20,PgClassExpression21,PgUnionAll23,Connection27,ConnectionItems29 bucket4
    classDef bucket6 stroke:#ff1493
    class Bucket6,__Item32,Edge33,Access34,PgCursor35,Access37,Access38,List40,Lambda41,Access43 bucket6
    classDef bucket7 stroke:#808000
    class Bucket7,Access42 bucket7
    classDef bucket8 stroke:#dda0dd
    class Bucket8 bucket8
    classDef bucket9 stroke:#ff0000
    class Bucket9,PgSelect44,First48,PgSelectRows49,PgSelectSingle50,PgClassExpression59,PgClassExpression61,PgClassExpression63 bucket9
    classDef bucket10 stroke:#ffff00
    class Bucket10,PgSelect52,First56,PgSelectRows57,PgSelectSingle58,PgClassExpression60,PgClassExpression62,PgClassExpression64 bucket10

